package com.loong.life.controller.forehead;

import com.loong.common.mvc.BaseForeheadController;
import com.loong.common.rest.Result;
import com.loong.common.validator.group.CommonValidate;
import com.loong.life.common.forehead.param.PhoneNumberForeheadParam;
import com.loong.life.common.forehead.result.AgentAndAgentProductForeheadResult;
import com.loong.life.handler.AgentInformationHandler;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description: 处理前台有关代理商信息请求的controller
 * @Author: 刘群
 * @Date: 2020/11/26 16:41
 */
@RestController
@RequestMapping("forehead/life/agentInformation")
public class AgentInformationForeheadController extends BaseForeheadController {

    @Resource
    private AgentInformationHandler agentHandler;

    /**
     * 根据手机号码查询运营商及运营商的产品
     * @param param 手机号码参数
     * @return 响应的结果
     */
    @PostMapping("operatorAndProducts")
    public Result<AgentAndAgentProductForeheadResult> getPhoneOperatorAndProducts(@RequestBody @Validated PhoneNumberForeheadParam param){
        return handlerExecutor.execute(() -> agentHandler.foreheadGetPhoneOperatorAndProducts(param));
    }

}
